<?php
!defined('P_W') && exit('Forbidden');

class PW_PageCacheConfigInfo {
	var $hid;

	function __construct($hid) {
		$this->hid = (int)$hid;
	}
	function PW_PageCacheConfigInfo($hid) {
		$this->__construct($hid);
	}
	
	function getConfig() {
		return $this->_pageConfig();
	}
	
	function setHid($hid) {
		$this->hid = (int)$hid;
	}
	
	function _pageConfig() {
		$cache_config = array(
			'flash'=> array('type'=>'flash','model'=>'flash','hid'=>$this->hid,'cachetime'=>0,'num'=>'5'),
			'newFeed'=> array('type'=>'feed','hid'=>$this->hid,'cachetime'=>0,'num'=>'1'),
			'newPrice'=> array('type'=>'price','hid'=>$this->hid,'cachetime'=>0,'num'=>'3'),
			'newThreadByTag' => array('type'=>'tag','model'=>'newinfor','hid'=>$this->hid,'cachetime'=>5000,'num'=>'9'),
			'newThread' => array('type'=>'group','model'=>'newreply','hid'=>$this->hid,'cachetime'=>5000,'num'=>'13'),
			'evaluations'=> array('type'=>'evaluations','hid'=>$this->hid,'cachetime'=>0,'num'=>'3'),
			'roundHouse' => array('type'=>'round','hid'=>$this->hid,'cachetime'=>5000,'num'=>'15'),
			'newHouse' => array('type'=>'housesort','sorttype'=>'new','cachetime'=>5000,'num'=>'10'),
			'scoreHouse' => array('type'=>'housesort','sorttype'=>'score','cachetime'=>5000,'num'=>'10'),
			'recommendHouse' => array('type'=>'housesort','sorttype'=>'recommend','num'=>'8'),
			'groupBuy' => array('type'=>'housesort','sorttype'=>'groupbuy','cachetime'=>5000,'num'=>'10'),
			'imageType'=> array('type'=>'imagetype','hid'=>$this->hid,'cachetime'=>0,'num'=>'8')
		);
		$topTypes = $this->_getTopTypes();
		foreach ($topTypes as $key=>$value) {
			$cache_config['imageType_'.$key] = array('type'=>'imagetype','hid'=>$this->hid,'round'=>$key,'cachetime'=>0,'num'=>'8');
		}
		return $cache_config;
	}
	function _getTopTypes() {
		global $topTypes;
		if ($topTypes) return $topTypes;
		$imageTypeService = House::loadClass('houseimagetype'); /* @var $imageTypeService PW_HouseImageType */
		return $imageTypeService->getTopTypes();
	}

}
?>